setCameraPreview

fun Engine.setCameraPreview(pixelStreamFill: DesignBlock, preview: Preview, mirrored: Boolean = false, onFirstFrameAvailable: () -> Unit = {})

Connects android camerax to the Engine. Calling this function will render the camera output to the pixelStreamFill. Configuration of the preview should be provided via camerax preview. Note that the dimensions of the block that holds pixelStreamFill should be set manually and have nothing to do with preview dimensions.

Parameters

pixelStreamFill

the target fill object, that should show the camera output.

preview

the camerax preview configuration object.

mirrored

whether preview output should be displayed as mirrored. Default value is false.

onFirstFrameAvailable

the callback that is invoked when the first frame of the camera preview is available. This can be a good point in time to make the block to which the pixelStreamFill is attached visible.


fun Engine.setCameraPreview(pixelStreamFill: DesignBlock, preview: Preview, mirroredState: StateFlow<Boolean>, onFirstFrameAvailable: () -> Unit = {})

Connects android camerax to the Engine. Calling this function will render the camera output to the pixelStreamFill. Configuration of the preview should be provided via camerax preview. Note that the dimensions of the block that holds pixelStreamFill should be set manually and have nothing to do with preview dimensions.

Parameters

pixelStreamFill

the target fill object, that should show the camera output.

preview

the camerax preview configuration object.

mirroredState

state object that holds information whether preview output should be displayed as mirrored. The value can be changed any time when the camera is being displayed. It is useful when switching between front and back cameras.

onFirstFrameAvailable

the callback that is invoked when the first frame of the camera preview is available. This can be a good point in time to make the block to which the pixelStreamFill is attached visible.